home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Draw / Sources / Utilities.cpp < prev   
Encoding:
Text File  |  1994-04-21  |  1.3 KB  |  44 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Utilities.cpp
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef UTILITIES_H
  14. #include "Utilities.h"
  15. #endif
  16.  
  17. // ----- Macintosh Includes -----
  18.  
  19. #ifndef __EVENTS__
  20. #include <Events.h>
  21. #endif
  22.  
  23. #pragma segment drawpart
  24.  
  25. //-------------------------------------------------------------------------
  26. // WaitForTick
  27. //-------------------------------------------------------------------------
  28.  
  29. void WaitForTick()
  30. {
  31.     long tick = ::TickCount()+1;
  32.     while (tick >= ::TickCount()) {}
  33. }
  34.  
  35. //-------------------------------------------------------------------------
  36. // MapPoint
  37. //-------------------------------------------------------------------------
  38.  
  39. void MapPoint(FW_SPlatformPoint& pt, const FW_SPlatformRect& srcRect, const FW_SPlatformRect& dstRect)
  40. {
  41.     pt.h = ((pt.h - srcRect.left) * (dstRect.right - dstRect.left)) / (srcRect.right - srcRect.left) + dstRect.left;
  42.     pt.v = ((pt.v - srcRect.top) * (dstRect.bottom - dstRect.top)) / (srcRect.bottom - srcRect.top) + dstRect.top;
  43. }
  44.